
export const $uStore = (state, payload) => {
    // 判断是否多层级调用，state中为对象存在的情况，诸如user.info.score = 1
    let nameArr = payload.name.split('.');
    let len = nameArr.length;
    if (len >= 2) {
        let obj = state[nameArr[0]];
        for (let i = 1; i < len - 1; i++) {
            obj = obj[nameArr[i]];
        }
        obj[nameArr[len - 1]] = payload.value;
    } else {
        // 单层级变量，在state就是一个普通变量的情况
        state[payload.name] = payload.value;
    }
}
// export const checkCurrentTab = (state) => {
//     if (state.vuex_tab_bar.list.length > 0) {
//         let url = ''
//         // #ifdef H5
//         url = location.pathname
//         // #endif
//         // #ifdef MP-WEIXIN
//         url = wx.getLaunchOptionsSync().path
//         // #endif
//         let index = state.vuex_tab_page.findIndex(item => item.includes(url))
//         state.vuex_tab_bar.current = index
//     } else {
//         state.vuex_tab_bar.current = -1
//     }
// }
